<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" value="123">
    <script>
        let keyword;
        const ipt = document.querySelector("input");
        
        // console.log(keyword);
        // ipt.addEventListener("keydown",()=>{
        //     console.log("onkeypress。。。"); 
        // })
        
        function getInputValue(){
            return new Promise((resolve)=>{
                ipt.addEventListener("input",()=>{
                    // console.log(111);
                    // console.log(ipt.value);
                    keyword = ipt.value;
                    resolve(keyword)
                })
            })
        }
        async function getLastKeyWord(){
            const lastKeyWord = await getInputValue()
            console.log(lastKeyWord);
        }
        getLastKeyWord()
    </script>
</body>
</html>